package com.lightboat.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lightboat.common.utils.DateUtils;
import com.lightboat.system.domain.CrmComment;
import com.lightboat.system.mapper.CrmCommentMapper;
import com.lightboat.system.service.ICrmCommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 评论Service业务层处理
 * 
 * @author lightboat
 * @date 2025-08-21
 */
@Service
@RequiredArgsConstructor
public class CrmCommentServiceImpl extends ServiceImpl<CrmCommentMapper, CrmComment> implements ICrmCommentService {

    private final CrmCommentMapper crmCommentMapper;

    /**
     * 查询评论
     * 
     * @param commentId 评论主键
     * @return 评论
     */
    @Override
    public CrmComment selectCrmCommentByCommentId(Long commentId)
    {
        return crmCommentMapper.selectById(commentId);
    }

    /**
     * 查询评论列表
     * 
     * @param crmComment 评论
     * @return 评论
     */
    @Override
    public List<CrmComment> selectCrmCommentList(CrmComment crmComment)
    {
        return crmCommentMapper.selectCrmCommentList(crmComment);
    }

    /**
     * 新增评论
     * 
     * @param crmComment 评论
     * @return 结果
     */
    @Override
    public int insertCrmComment(CrmComment crmComment)
    {
        crmComment.setCreateTime(DateUtils.getNowDate());
        return crmCommentMapper.insert(crmComment);
    }

    /**
     * 修改评论
     * 
     * @param crmComment 评论
     * @return 结果
     */
    @Override
    public int updateCrmComment(CrmComment crmComment)
    {
        crmComment.setUpdateTime(DateUtils.getNowDate());
        return crmCommentMapper.updateById(crmComment);
    }

    /**
     * 批量删除评论
     * 
     * @param commentIds 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deleteCrmCommentByCommentIds(Long[] commentIds)
    {
        return crmCommentMapper.deleteCrmCommentByCommentIds(commentIds);
    }

    /**
     * 删除评论信息
     * 
     * @param commentId 评论主键
     * @return 结果
     */
    @Override
    public int deleteCrmCommentByCommentId(Long commentId)
    {
        return crmCommentMapper.deleteCrmCommentByCommentId(commentId);
    }
}
